import { http } from '@/utils/http'
import type { PageData } from '@/types/global'
import type {
  CategoryGoodItem,
  IBannerListItem,
  IBannerParams,
  ISearchPageParams,
  TagListItem,
} from '@/types/category'

/**
 * 分类列表-小程序
 */
export const getBannerListAPI = (params: IBannerParams) => {
  return http<IBannerListItem[]>({
    method: 'POST',
    url: '/sys/webchat/categories/banner/list',
    data: params,
  })
}

/**
 * 分类菜单列表
 * @param data
 * @returns
 */
export const getCategoryListAPI = (data: any) => {
  return http<any[]>({
    method: 'POST',
    url: '/sys/webchat/categories/list',
    data,
  })
}
export const searchGoodsAPI = (data: ISearchPageParams) => {
  return http<PageData<CategoryGoodItem[]>>({
    method: 'POST',
    url: '/sys/webchat/categories/searchGoods',
    data,
  })
}
export const tagListAPI = () => {
  return http<TagListItem[]>({
    method: 'GET',
    url: '/sys/webchat/categories/taglist',
    data: {},
  })
}
